package com.tz.actions;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.tz.entity.Faq;
import com.tz.entity.Product;
import com.tz.service.FaqService;
import com.tz.service.ProductService;
import com.tz.util.MyAcUtil;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 16-7-19.
 */
@Namespace("/exams")
@ParentPackage("json-default")
public class FaqAction extends ActionSupport {

    @Autowired
    private FaqService faqService;

    private List<Faq> result;

    public FaqAction() {

    }

    @Action( value = "faq", results = {
            @Result(type = "json" ,params = {"root", "result"})
    })

    public String list() {

        result = faqService.getAll();
        return SUCCESS;
    }

    public List<Faq> getResult() {
        return result;
    }

    public void setResult(List<Faq> result) {
        this.result = result;
    }

}
